<?php
$auth = Zend_Auth::getInstance();

if (!$auth->hasIdentity()) {
    echo '<b>' . $this->translate('theme-scripts-auth:notLoggedIn') . '</b> ' . $this->translate('theme-scripts-auth:logInHere',array('<a href="' . $this->url(array(), 'login', true) . '" id="authLogin" class="authModal">', '</a>'));
} else {
	
	$identity = $auth->getIdentity();
	
    echo $this->translate('theme-scripts-auth:welcome') . ' ';
	
	if ($identity->firstName != '' && $identity->lastName != '') {
		echo $identity->firstName . ' ' . $identity->lastName;	
	} else {
    	echo $auth->getIdentity()->username;
	}
	
	echo '&nbsp; | &nbsp;';

    echo '<a href="' . $this->url(array(), 'account', true) . '" id="authMyAccount">' . $this->translate('theme-scripts-auth:myAccount') . '</a>'
    	. '&nbsp; | &nbsp;'
        . '<a href="' . $this->url(array('action' => 'logout'), 'login', true) . '" id="authLogout" class="authModal">' . $this->translate('theme-scripts-auth:logOut') . '</a>';
}
    

  	$translate = Zend_Registry::get('Zend_Translate');
  	if (count($translate->getList()) > 1) {
  		$list = $translate->getList();
  		foreach ($list as &$l) {
  			$l = Ot_Language::getLanguageName($l);
  		}
  		unset($l);

  		echo '&nbsp; | &nbsp;';
  		echo $this->formLabel('language_select', 'Language: ');
  		echo $this->formSelect('language_select', $translate->getLocale(), null, $list);
  	}
?>
<div id="authLogoutDialog" title="Logout">
<?php echo $this->translate('theme-scripts-auth:sureLogOut'); ?>
</div>